<%
    var obj={pageTitle:"新增管理员"}
%>
{{include "../layout_header.html" obj}}
<div class="container">
    <div class=" page-header">
        <h2 class=" text-center text-primary">新增管理员</h2>
    </div>
    <form action="/adminInfo/doAddAdminInfo?_csrf={{csrf}}" class=" form-horizontal" method="POST" id="addAdminInfo">
        <div class=" form-group">
            <label for="" class=" col-sm-2 control-label">管理员账号</label>
            <div class=" col-sm-7">
                <input id="adminid" name="adminid" type="text" class=" form-control" data-rule-required="true"
                    placeholder="请输入管理员账号">
            </div>
            <div class=" col-sm-3"></div>
        </div>
        <div class=" form-group">
            <label for="" class=" col-sm-2 control-label">管理员密码</label>
            <div class=" col-sm-7">
                <input name="adminpwd" id="adminpwd" type="password" class=" form-control" data-rule-required="true"
                    placeholder="请输入管理员密码">
            </div>
            <div class=" col-sm-3"></div>
        </div>
        <div class=" form-group">
            <label for="" class=" col-sm-2 control-label">确认密码</label>
            <div class=" col-sm-7">
                <input name="confirmPwd" type="password" class=" form-control" data-rule-required="true" data-rule-equalTo="#adminpwd"
                    placeholder="请输入确认密码">
            </div>
            <div class=" col-sm-3"></div>
        </div>
        <div class=" form-group">
            <label for="" class=" col-sm-2 control-label">真实姓名</label>
            <div class=" col-sm-7">
                <input name="realname" type="text" class=" form-control" data-rule-required="true" 
                    placeholder="请输入真实姓名">
            </div>
            <div class=" col-sm-3"></div>
        </div>
        <div class=" form-group">
            <label for="" class=" col-sm-2 control-label">手机号码</label>
            <div class=" col-sm-7">
                <input name="admintel" type="text" class=" form-control" data-rule-required="true" 
                    placeholder="请输入手机号码">
            </div>
            <div class=" col-sm-3"></div>
        </div>

        <div class=" form-group">
            <div class="col-sm-7 col-sm-offset-2">
                <button type="submit" class="btn btn-primary" id="btnSave">
                    <span class=" glyphicon glyphicon-floppy-saved"></span> 保存数据
                </button>
                <a href="/adminInfo/list" class=" btn btn-danger">
                    <span class=" glyphicon glyphicon-chevron-left"></span> 返回列表
                </a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#addAdminInfo").validate({
            errorPlacement:function(error,element){
                error.appendTo(element.parent().next());
            },
            errorClass:"text-danger"
        });
        $("#adminid").blur(function(){
            var adminid=$(this).val();
            if(adminid){
                $.get("/adminInfo/checkAdminId?adminid="+adminid,function(data){
                    if(data==true){
                        layer.alert("当前账号已存在");
                        $("#adminid").val("");
                    }
                    
                })
            }
        });
    })
</script>

{{include "../layout_footer.html"}}